home *** CD-ROM | disk | FTP | other *** search
/ Motor Sport Digital Archive Collection 1960s / Motor Sport Digital Archive Collection 1960s.iso / main.swf / scripts / views / BrowseIssueTab.as < prev    next >
Encoding:
Text File  |  2008-05-21  |  10.1 KB  |  295 lines

  1. package views
  2. {
  3.    import events.NavigationEvent;
  4.    import flash.accessibility.*;
  5.    import flash.debugger.*;
  6.    import flash.display.*;
  7.    import flash.errors.*;
  8.    import flash.events.*;
  9.    import flash.external.*;
  10.    import flash.filters.*;
  11.    import flash.geom.*;
  12.    import flash.media.*;
  13.    import flash.net.*;
  14.    import flash.printing.*;
  15.    import flash.profiler.*;
  16.    import flash.system.*;
  17.    import flash.text.*;
  18.    import flash.ui.*;
  19.    import flash.utils.*;
  20.    import flash.xml.*;
  21.    import model.PresentationModel;
  22.    import mx.binding.*;
  23.    import mx.containers.Canvas;
  24.    import mx.containers.HBox;
  25.    import mx.controls.Image;
  26.    import mx.core.Repeater;
  27.    import mx.core.UIComponentDescriptor;
  28.    import mx.core.mx_internal;
  29.    import mx.events.PropertyChangeEvent;
  30.    import mx.styles.*;
  31.    
  32.    public class BrowseIssueTab extends Canvas
  33.    {
  34.       private static var _watcherSetupUtil:IWatcherSetupUtil;
  35.       
  36.       private var _bindings:Array;
  37.       
  38.       public var _bindingsByDestination:Object;
  39.       
  40.       public var _bindingsBeginWithWord:Object;
  41.       
  42.       private var _embed_mxml____embedded_assets_browse_issue_tab_bg_png_381623915:Class;
  43.       
  44.       [Bindable]
  45.       private var _1857328081presentationModel:PresentationModel;
  46.       
  47.       [Bindable]
  48.       private var _185670876issuesRpt:Repeater;
  49.       
  50.       [Bindable]
  51.       private var _902752723_CoverThumb1:Array;
  52.       
  53.       private var _watchers:Array;
  54.       
  55.       [Bindable]
  56.       private var _1506627793_HBox1:HBox;
  57.       
  58.       private var _documentDescriptor_:UIComponentDescriptor;
  59.       
  60.       public function BrowseIssueTab()
  61.       {
  62.          _documentDescriptor_ = new UIComponentDescriptor({
  63.             "type":Canvas,
  64.             "propertiesFactory":function():Object
  65.             {
  66.                return {
  67.                   "width":1094,
  68.                   "height":157,
  69.                   "childDescriptors":[new UIComponentDescriptor({
  70.                      "type":Image,
  71.                      "propertiesFactory":function():Object
  72.                      {
  73.                         return {
  74.                            "blendMode":"multiply",
  75.                            "source":_embed_mxml____embedded_assets_browse_issue_tab_bg_png_381623915,
  76.                            "width":1094,
  77.                            "height":157
  78.                         };
  79.                      }
  80.                   }),new UIComponentDescriptor({
  81.                      "type":HBox,
  82.                      "id":"_HBox1",
  83.                      "stylesFactory":function():void
  84.                      {
  85.                         this.horizontalGap = 10;
  86.                      },
  87.                      "propertiesFactory":function():Object
  88.                      {
  89.                         return {
  90.                            "x":29,
  91.                            "y":26,
  92.                            "width":1031,
  93.                            "height":147,
  94.                            "horizontalScrollPolicy":"off",
  95.                            "verticalScrollPolicy":"off",
  96.                            "childDescriptors":[new UIComponentDescriptor({
  97.                               "type":Repeater,
  98.                               "id":"issuesRpt",
  99.                               "propertiesFactory":function():Object
  100.                               {
  101.                                  return {"childDescriptors":[new UIComponentDescriptor({
  102.                                     "type":CoverThumb,
  103.                                     "id":"_CoverThumb1",
  104.                                     "events":{"click":"___CoverThumb1_click"},
  105.                                     "propertiesFactory":function():Object
  106.                                     {
  107.                                        return {
  108.                                           "buttonMode":true,
  109.                                           "styleName":"coverThumbOut"
  110.                                        };
  111.                                     }
  112.                                  })]};
  113.                               }
  114.                            })]
  115.                         };
  116.                      }
  117.                   })]
  118.                };
  119.             }
  120.          });
  121.          _embed_mxml____embedded_assets_browse_issue_tab_bg_png_381623915 = BrowseIssueTab__embed_mxml____embedded_assets_browse_issue_tab_bg_png_381623915;
  122.          super();
  123.          mx_internal::_document = this;
  124.          this.width = 1094;
  125.          this.height = 157;
  126.          this.horizontalScrollPolicy = "off";
  127.          this.verticalScrollPolicy = "off";
  128.       }
  129.       
  130.       public static function set watcherSetupUtil(param1:IWatcherSetupUtil) : void
  131.       {
  132.          BrowseIssueTab._watcherSetupUtil = param1;
  133.       }
  134.       
  135.       public function ___CoverThumb1_click(param1:MouseEvent) : void
  136.       {
  137.          clickHandler(param1);
  138.       }
  139.       
  140.       public function set presentationModel(param1:PresentationModel) : void
  141.       {
  142.          var _loc2_:Object = null;
  143.          _loc2_ = this._1857328081presentationModel;
  144.          if(_loc2_ !== param1)
  145.          {
  146.             this._1857328081presentationModel = param1;
  147.             dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"presentationModel",_loc2_,param1));
  148.          }
  149.       }
  150.       
  151.       private function _BrowseIssueTab_bindingExprs() : void
  152.       {
  153.          var _loc1_:* = undefined;
  154.          _loc1_ = presentationModel.issues;
  155.          _loc1_ = formatText(issuesRpt.currentItem.file);
  156.          _loc1_ = presentationModel.yearString + "/" + issuesRpt.currentItem.file + "-000.jpg";
  157.       }
  158.       
  159.       private function _BrowseIssueTab_bindingsSetup() : void
  160.       {
  161.          var binding:Binding = null;
  162.          if(!_bindings)
  163.          {
  164.             _bindings = [];
  165.          }
  166.          if(!_watchers)
  167.          {
  168.             _watchers = [];
  169.          }
  170.          binding = new Binding(this,function():Object
  171.          {
  172.             return presentationModel.issues;
  173.          },function(param1:Object):void
  174.          {
  175.             issuesRpt.dataProvider = param1;
  176.          },"issuesRpt.dataProvider");
  177.          _bindings[0] = binding;
  178.          binding = new RepeatableBinding(this,function(param1:Array, param2:Array):String
  179.          {
  180.             var _loc3_:* = undefined;
  181.             var _loc4_:* = undefined;
  182.             _loc3_ = formatText(issuesRpt.mx_internal::getItemAt(param2[0]).file);
  183.             return _loc3_ == undefined ? null : String(_loc3_);
  184.          },function(param1:String, param2:Array):void
  185.          {
  186.             _CoverThumb1[param2[0]].labelTxt = param1;
  187.          },"_CoverThumb1.labelTxt");
  188.          _bindings[1] = binding;
  189.          binding = new RepeatableBinding(this,function(param1:Array, param2:Array):String
  190.          {
  191.             var _loc3_:* = undefined;
  192.             var _loc4_:* = undefined;
  193.             _loc3_ = presentationModel.yearString + "/" + issuesRpt.mx_internal::getItemAt(param2[0]).file + "-000.jpg";
  194.             return _loc3_ == undefined ? null : String(_loc3_);
  195.          },function(param1:String, param2:Array):void
  196.          {
  197.             _CoverThumb1[param2[0]].imgFile = param1;
  198.          },"_CoverThumb1.imgFile");
  199.          _bindings[2] = binding;
  200.       }
  201.       
  202.       [Bindable(event="propertyChange")]
  203.       public function get presentationModel() : PresentationModel
  204.       {
  205.          return this._1857328081presentationModel;
  206.       }
  207.       
  208.       private function clickHandler(param1:Event) : void
  209.       {
  210.          var _loc2_:Object = null;
  211.          _loc2_ = param1.currentTarget.getRepeaterItem();
  212.          _loc2_.index = param1.currentTarget.repeaterIndex;
  213.          dispatchEvent(new NavigationEvent(NavigationEvent.ISSUE_SELECT,_loc2_,true));
  214.       }
  215.       
  216.       [Bindable(event="propertyChange")]
  217.       public function get issuesRpt() : Repeater
  218.       {
  219.          return this._185670876issuesRpt;
  220.       }
  221.       
  222.       public function set issuesRpt(param1:Repeater) : void
  223.       {
  224.          var _loc2_:Object = null;
  225.          _loc2_ = this._185670876issuesRpt;
  226.          if(_loc2_ !== param1)
  227.          {
  228.             this._185670876issuesRpt = param1;
  229.             dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"issuesRpt",_loc2_,param1));
  230.          }
  231.       }
  232.       
  233.       private function formatText(param1:String) : String
  234.       {
  235.          var _loc2_:RegExp = null;
  236.          _loc2_ = /([0-9]+)\s([A-Za-z]+)\s([0-9]+)/gi;
  237.          return param1.replace(_loc2_,"$2");
  238.       }
  239.       
  240.       [Bindable(event="propertyChange")]
  241.       public function get _CoverThumb1() : Array
  242.       {
  243.          return this._902752723_CoverThumb1;
  244.       }
  245.       
  246.       public function set _HBox1(param1:HBox) : void
  247.       {
  248.          var _loc2_:Object = null;
  249.          _loc2_ = this._1506627793_HBox1;
  250.          if(_loc2_ !== param1)
  251.          {
  252.             this._1506627793_HBox1 = param1;
  253.             dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"_HBox1",_loc2_,param1));
  254.          }
  255.       }
  256.       
  257.       [Bindable(event="propertyChange")]
  258.       public function get _HBox1() : HBox
  259.       {
  260.          return this._1506627793_HBox1;
  261.       }
  262.       
  263.       override public function initialize() : void
  264.       {
  265.          var target:BrowseIssueTab = null;
  266.          var watcherSetupUtilClass:Object = null;
  267.          mx_internal::setDocumentDescriptor(_documentDescriptor_);
  268.          _BrowseIssueTab_bindingsSetup();
  269.          target = this;
  270.          if(_watcherSetupUtil == null)
  271.          {
  272.             watcherSetupUtilClass = getDefinitionByName("_views_BrowseIssueTabWatcherSetupUtil");
  273.             watcherSetupUtilClass["init"](null);
  274.          }
  275.          _watcherSetupUtil.setup(this,function(param1:String):*
  276.          {
  277.             return target[param1];
  278.          },_bindings,_watchers);
  279.          super.initialize();
  280.       }
  281.       
  282.       public function set _CoverThumb1(param1:Array) : void
  283.       {
  284.          var _loc2_:Object = null;
  285.          _loc2_ = this._902752723_CoverThumb1;
  286.          if(_loc2_ !== param1)
  287.          {
  288.             this._902752723_CoverThumb1 = param1;
  289.             dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"_CoverThumb1",_loc2_,param1));
  290.          }
  291.       }
  292.    }
  293. }
  294.  
  295.